﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.SysTools;
using LJX.SmartPark.Service.SysTools;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.SysTools.FormConstructionService;

namespace LJX.SmartPark.WebApi.Controllers.SysTools
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "SysTools")]
    public class FormConstructionController : ControllerBase
    {
        private readonly IFormConstructionService _FormConstructionService;
        public FormConstructionController(IFormConstructionService FormConstructionService)
        {
            _FormConstructionService = FormConstructionService;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> PostAddFormConstruction(FormConstruction input)
        {
            var result = _FormConstructionService.FormConstructionAdd(input);
            return result;
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpDelete]
        public Task<Response<bool>> DeleteFormConstruction(FormConstruction input)
        {
            var result = _FormConstructionService.FormConstructionDelete(input);
            return result;
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUpdateFormConstruction(FormConstruction input)
        {
            var result = _FormConstructionService.FormConstructionUpdate(input);

            return result;

        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> FormConstructionsDeleteDatas(string[] ids)
        {

            return _FormConstructionService.FormConstructionDeleteDatas(ids);
        }
        /// <summary>
        /// 分页显示查询
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<List<FormConstruction>> GetFormConstructionsPage(SelectLogData select)
        {
            var result = _FormConstructionService.GetFormConstructionPage(select);
            return result.Result;
        }
        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _FormConstructionService.GetCount();
        }
    }
}
